package com.mjk.common.tools.plumelog.service.util;

import com.mjk.common.util.TimeUtils;
import com.plumelog.core.constant.LogMessageConstant;

import java.util.Date;

public class IndexUtil {

    public static String getRunLogIndex(long epochMillis) {
        return LogMessageConstant.ES_INDEX + LogMessageConstant.LOG_TYPE_RUN + "_"
                + TimeUtils.formatTime(new Date(epochMillis),TimeUtils.DATE_FORMAT_YEARDATEANDMON );
    }

    public static String getTraceLogIndex(long epochMillis) {
        return LogMessageConstant.ES_INDEX + LogMessageConstant.LOG_TYPE_TRACE + "_"
                + TimeUtils.formatTime(new Date(epochMillis),TimeUtils.DATE_FORMAT_YEARDATEANDMON );
    }

    public static String getRunLogIndexWithHour(long epochMillis) {
        return LogMessageConstant.ES_INDEX + LogMessageConstant.LOG_TYPE_RUN + "_"
                + TimeUtils.formatTime(new Date(epochMillis),TimeUtils.DATE_FORMAT_YEARDATEANDMONHORE );
    }

    public static String getTraceLogIndexWithHour(long epochMillis) {
        return LogMessageConstant.ES_INDEX + LogMessageConstant.LOG_TYPE_TRACE + "_"
                + TimeUtils.formatTime(new Date(epochMillis),TimeUtils.DATE_FORMAT_YEARDATEANDMONHORE );
    }

}
